<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>滴滴法律</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<!--[if lt IE 9]> 
		<script> src="js/html5shiv.min.js"></script> 
	<![endif]-->
</head>
<body>
	<div class="well well-sm">热门话题 / 婚姻话题</div>
	<table class="table table-striped table-hover">
		<thead>
			<tr>
				<th>标题</th>
				<th>提交时间</th>
				<th>讨论人数</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="lawThemes" items="${lawThemes}">
			<tr>
				<td><a href="topic/comments/${lawThemes.themeid}">${lawThemes.themename}</a></td>
				<td><fmt:formatDate value="${lawThemes.time}" pattern="yyyy-MM-dd hh:mm:ss"/></td>
				<td>${lawThemes.support}</td>				
				<td>
					<a href="topic/comments/${lawThemes.themeid}" class="btn btn-info btn-xs">详情</a>
					<input type="button" class="btn btn-danger btn-xs" name="${lawThemes.themeid}" id="del-btn" value="删除">
				</td>										
			</tr>
			</c:forEach>
		</tbody>
	</table>
</body>
<script type="text/javascript">
	$('#del-btn').on('click',function(){
		var themeId = $(this).attr("name");
		$.ajax({
       	 type: 'get',
   	     url: "topic/theme/del/" + themeId,
   	     dataType:'json',    
   	     success: function (data){
   	     	alert(data.msg);
   	     	if (data.code == 200) {
   	     		location.reload();
   	     	}
   	     }
	  });
	});
</script>
</html>